package com.liaoye.hellocustomview.evaluator;

import android.animation.TypeEvaluator;

import com.liaoye.hellocustomview.model.Point;

/**
 * 这个是抛物线球的动画转换器
 */
public class FallingBallEvaluator implements TypeEvaluator<Point> {
    private Point point = new Point();

    @Override
    public Point evaluate(float fraction, Point startPoint, Point endPoint) {
        point.x = (int) (startPoint.x + (endPoint.x - startPoint.x) * fraction);
        if (fraction*2<=1) {
            point.y = (int)(startPoint.y + fraction*2*(endPoint.y - startPoint.y)) ;
        }else {
            point.y = endPoint.y;
        }
        return point;
    }
}
